cmake_minimum_required(VERSION 3.16)

#message("This is a status message.")
project(DDConnect VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

#set(QML_DIR "${CMAKE_CURRENT_SOURCE_DIR}/qml")输出目录信息

#message(${CMAKE_CURRENT_SOURCE_DIR})
find_package(Qt6 6.4 REQUIRED COMPONENTS Quick Network)

qt_standard_project_setup()

qt_add_executable(appDDConnect
    main.cpp
    logo.rc# 修改程序和桌面图标

)
# 指定 QML 文件所在的目录
set(QML_DIR "qml")
qt_add_qml_module(appDDConnect
    URI DDConnect
    VERSION 1.0
    QML_FILES
            ${QML_DIR}/Main.qml
            ${QML_DIR}/Mqtt_page.qml
            ${QML_DIR}/MyButton.qml
            ${QML_DIR}/Tcp_page.qml
            ${QML_DIR}/Udp_page.qml #Udp_page.qml不加在这块会在使用的地方报Udp_page is not a type错误
    RESOURCES


    SOURCES
        udp.h
        udp.cpp
        tcp.h
        tcp.cpp
        #QML_FILES qml/Tcp_page.qml



)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appDDConnect PROPERTIES
#    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appDDConnect
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appDDConnect
    PRIVATE Qt6::Quick Qt6::Network
)

include(GNUInstallDirs)
install(TARGETS appDDConnect
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
